import { http } from '@/utils/request'
import type { ICategoryResult, IsortParams, ISubFilter, ITemporary } from '@/types/api/category'

// 获取单个顶级分类信息
export const findTopCategory = (id: string | string[]) => {
  return http<ICategoryResult>('get', '/category', { id })
}

// 获取二级分类筛选条件数据
export const findSubCategoryFilter = (id: string | string[]) => {
  return http<ISubFilter>('get', '/category/sub/filter', { id })
}

// 获取分类下的商品（带筛选条件）
export const findSubCategoryGoods = (params: IsortParams) => {
  return http<ITemporary>('post', '/category/goods/temporary', params)
}
